<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" import="java.net.URLEncoder"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<script type="text/javascript">
function goback() {
		history.go(-1);
	}
function valid() {
	$("#div_old_password").removeClass("control-group error");
	$("#div_old_password").addClass("control-group");
	$("#div_new_password").removeClass("control-group error");
	$("#div_new_password").addClass("control-group");
	$("#div_repassword").removeClass("control-group error");
	$("#div_repassword").addClass("control-group");
	document.getElementById("help_password").innerHTML = "";
	document.getElementById("help_newPassword").innerHTML = "";
	document.getElementById("help_repassword").innerHTML = "";
	var password = $("#password").val().trim();
	var newPassword = $("#newPassword").val().trim();
	var repassword = $("#repassword").val().trim();
	if (password == "") {
		$("#div_old_password").removeClass("control-group");
		$("#div_old_password").addClass("control-group error");
		document.getElementById("help_password").innerHTML = "原始密码不能为空";
		return false;
	}
	if (newPassword == "") {
		$("#div_new_password").removeClass("control-group");
		$("#div_new_password").addClass("control-group error");
		document.getElementById("help_newPassword").innerHTML = "新密码不能为空";
		return false;
	}
	if (repassword == "") {
		$("#div_repassword").removeClass("control-group");
		$("#div_repassword").addClass("control-group error");
		document.getElementById("help_repassword").innerHTML = "确认密码不能为空";
		return false;
	}
	if (newPassword != repassword) {
		$("#div_repassword").removeClass("control-group");
		$("#div_repassword").addClass("control-group error");
		document.getElementById("help_repassword").innerHTML = "确认密码与新密码不一致";
		return false;
	}
	return true;
}
</script>

<div class="page-header">
	<h3 style="margin-top: auto">修改密码</h3>
</div>
<div class="row-fluid">
		<form class="form-horizontal"
			action="<%=request.getContextPath()%>/user/update/password" method="POST" onsubmit="return valid()">
				<div class="control-group" id="div_old_password">
					<label class="control-label">原始密码&nbsp;</label>
					<div class="controls">
						<input type="password" placeholder="原始密码" name="password" id="password" />
						<span class="help-inline" id="help_password">${errormsg}</span>
					</div>
				</div>
				<div class="control-group" id="div_new_password">
					<label class="control-label">新密码&nbsp;</label>
					<div class="controls">
						<input type="password" placeholder="新密码" name="newPassword"
							id="newPassword" /> <span class="help-inline" id="help_newPassword"></span>
					</div>
				</div>
				<div class="control-group" id="div_repassword">
					<label class="control-label">确认密码&nbsp;</label>
					<div class="controls">
						<input type="password" placeholder="确认密码" name="repassword"
							id="repassword" /> <span class="help-inline"
							id="help_repassword"></span>
					</div>
				</div>
				<div class="control-group">
				<div class="controls">
					<button type="submit" class="btn" id="submit"><i class="icon-ok"></i>&nbsp;提交</button>
					<button type="button" class="btn" style="margin-left=50px;" onclick="goback()"><i class="icon-remove"></i>&nbsp;取消</button>
				</div>
			</div>
		</form>
	</div>